<?php
namespace app\serversms\validate;
use \app\manage\validate\BaseValidate;

class Sms extends BaseValidate
{
    
	protected $rule =   [
        'app_id'  => ['integer','gt'=>0],
        'mobile'=>['regex'=>'/^1[3|4|5|7|8]\d{9}$/'],
		'action'  => ['min'=>2],
        'id'=>['integer','gt'=>0],
        'sms_info'=>['array','length'=>2],
        'text'=>['min'=>5],
        'apikey'=>['length'=>32],
        'page'=>['integer','gt'=>0],
        'listRows'=>['integer','gt'=>0,'elt'=>50],
    ];

    protected $message  =   [
        'action' => '标识action字符长度最小为2',
        'text' => 'sms_info短信配置信息中的模板长度最小为5',
        'apikey' => 'sms_info短信配置信息中的apikey为32个字符',
        'page' => '当前页为大于0的整数',
        'listRows' => '每页显示的条数范围为1-50',
    ];

    protected $scene = [
        'addSms' => ['app_id','action','sms_info'],
        'editSms' => [
            'id'=>['require','integer','gt'=>0],
            'app_id','action','sms_info'
        ],
        'smsInfo' => ['app_id','id'],
        'delOneSms' => ['app_id','id'],
        'smsList' => ['app_id'=>['regex' => '^\d+(,\d+)*$'],'page','listRows'],
        'logList' => ['page','listRows'],
    ];

}